package com.example.financecollegeorderdish.db

import androidx.room.TypeConverter
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import java.lang.reflect.Type


class Converters{
    @TypeConverter
    fun fromStringArray(stringArray: Array<String>): String {
        val gson = Gson()
        return gson.toJson(stringArray)
    }

    @TypeConverter
    fun toStringArray(json: String?): Array<String> {
        val gson = Gson()
        val stringArrayType: Type = object : TypeToken<Array<String>>() {}.type
        return gson.fromJson(json, stringArrayType)
    }
}